﻿<UserControl x:Class="Fdd.Aspen.Client.Controls.Error"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
            
            <Storyboard x:Key="makeErrorVisible">
                <DoubleAnimation
                    Duration="0:0:0.4"
                    To="140"
                    Storyboard.TargetName="LayoutRoot"
                    Storyboard.TargetProperty="Height">

                </DoubleAnimation>

                <DoubleAnimation
                    Duration="0:0:0.4"
                    BeginTime="0:0:0.30"
                    To="1"
                    Storyboard.TargetName="LayoutRoot"
                    Storyboard.TargetProperty="Opacity">

                </DoubleAnimation>
            </Storyboard>

            <Storyboard x:Key="makeErrorHidden">
                <DoubleAnimation
                    Duration="0:0:0.3"
                    To="0"
                    Storyboard.TargetName="LayoutRoot"
                    Storyboard.TargetProperty="Height">

                </DoubleAnimation>

                <DoubleAnimation
                    Duration="0:0:0.3"
                    BeginTime="0:0:0.2"
                    To="0"
                    Storyboard.TargetName="LayoutRoot"
                    Storyboard.TargetProperty="Opacity">

                </DoubleAnimation>
            </Storyboard>

        </ResourceDictionary>

    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Height="0" Opacity="0">

        <Border Style="{StaticResource ExceptionWindow}" CornerRadius="8" BorderThickness="2">

            <Border.Effect>
                <DropShadowEffect Opacity="0.5" ShadowDepth="3"/>
            </Border.Effect>

            <Grid Margin="10,10,5,10">

                <Grid.RowDefinitions>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <StackPanel Orientation="Horizontal">
                    <Image Height="16" Source="../Resources/Images/error.png"/>
                    <TextBlock Margin="5" VerticalAlignment="Center" FontSize="16" FontWeight="bold" Text="An Error Occured!"/>
                </StackPanel>

                <Image MouseLeftButtonUp="Image_MouseLeftButtonUp" Margin="0,0,0,0" Width="20" Source="../Resources/Images/warning.png" VerticalAlignment="Top" HorizontalAlignment="Right"/>

                <StackPanel Grid.Row="1">

                    <TextBlock x:Name="errorMessage" TextWrapping="Wrap"/>

                    <TextBlock TextWrapping="Wrap">
                            Please try again if the same error occurs, please contact the administrator.
                            <Run Foreground="Blue">support@something.com</Run>
                    </TextBlock>

                </StackPanel>

            </Grid>

        </Border>
    </Grid>
    
</UserControl>
